home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Comm / AmiTCP30b2.lha / src / rpclib / svc_run.c < prev    next >
C/C++ Source or Header  |  1994-03-09  |  2KB  |  86 lines

  1. /*
  2.  * $Id: svc_run.c,v 1.2 1993/11/10 02:50:54 jraja Exp $
  3.  *
  4.  * $Log: svc_run.c,v $
  5.  * Revision 1.2  1993/11/10  02:50:54  jraja
  6.  * Fixed includes.
  7.  * Removed EINTR handling for the AMITCP (lets CTRL-C come through).
  8.  *
  9.  */
  10. /* @(#)svc_run.c    2.1 88/07/29 4.0 RPCSRC */
  11. #if !defined(lint) && defined(SCCSIDS)
  12. static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
  13. #endif
  14.  
  15. /*
  16.  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  17.  * unrestricted use provided that this legend is included on all tape
  18.  * media and as a part of the software program in whole or part.  Users
  19.  * may copy or modify Sun RPC without charge, but are not authorized
  20.  * to license or distribute it to anyone else except as part of a product or
  21.  * program developed by the user.
  22.  * 
  23.  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  24.  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  25.  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  26.  * 
  27.  * Sun RPC is provided with no support and without any obligation on the
  28.  * part of Sun Microsystems, Inc. to assist in its use, correction,
  29.  * modification or enhancement.
  30.  * 
  31.  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  32.  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  33.  * OR ANY PART THEREOF.
  34.  * 
  35.  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  36.  * or profits or other special, indirect and consequential damages, even if
  37.  * Sun has been advised of the possibility of such damages.
  38.  * 
  39.  * Sun Microsystems, Inc.
  40.  * 2550 Garcia Avenue
  41.  * Mountain View, California  94043
  42.  */
  43.  
  44. /*
  45.  * This is the rpc server side idle loop
  46.  * Wait for input, call server program.
  47.  */
  48. #include <sys/param.h>
  49. #include <rpc/rpc.h>
  50. #include <errno.h>
  51. #include <sys/socket.h>
  52.  
  53. void
  54. svc_run()
  55. {
  56. #ifdef FD_SETSIZE
  57.     fd_set readfds;
  58. #else
  59.       int readfds;
  60. #endif /* def FD_SETSIZE */
  61.  
  62.     for (;;) {
  63. #ifdef FD_SETSIZE
  64.         readfds = svc_fdset;
  65. #else
  66.         readfds = svc_fds;
  67. #endif /* def FD_SETSIZE */
  68.     
  69.     switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
  70.                    NULL)) {
  71.         case -1:
  72. #ifndef AMITCP /* EINTR is returned in case of a CTRL-C by default */
  73.             if (errno == EINTR) {
  74.                 continue;
  75.             }
  76. #endif
  77.             perror("svc_run: - select failed");
  78.             return;
  79.         case 0:
  80.             continue;
  81.         default:
  82.             svc_getreqset(&readfds);
  83.         }
  84.     }
  85. }
  86.